{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7f959254",
   "metadata": {},
   "source": [
    "# Feature Adversaries Attack in PyTorch\n",
    "\n",
    "Before diving into the attack, let's first prepare a classification model. We utilize a script from the `examples` folders."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d4de108e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy on benign test examples: 96.61999999999999%\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "import torch.nn as nn\n",
    "import torch.nn.functional as F\n",
    "import torch.optim as optim\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "\n",
    "from art.attacks.evasion import FeatureAdversariesPyTorch\n",
    "from art.estimators.classification import PyTorchClassifier\n",
    "from art.utils import load_mnist\n",
    "\n",
    "\n",
    "# Step 1: Load the MNIST dataset\n",
    "\n",
    "(x_train, y_train), (x_test, y_test), min_pixel_value, max_pixel_value = load_mnist()\n",
    "\n",
    "# Step 1a: Swap axes to PyTorch's NCHW format\n",
    "\n",
    "x_train = np.transpose(x_train, (0, 3, 1, 2)).astype(np.float32)\n",
    "x_test = np.transpose(x_test, (0, 3, 1, 2)).astype(np.float32)\n",
    "\n",
    "# Step 2: Create the model\n",
    "\n",
    "model = nn.Sequential(\n",
    "    nn.Conv2d(1, 4, 5), nn.ReLU(), nn.MaxPool2d(2, 2), \n",
    "    nn.Conv2d(4, 10, 5), nn.ReLU(), nn.MaxPool2d(2, 2),\n",
    "    nn.Flatten(), \n",
    "    nn.Linear(4*4*10, 100),    \n",
    "    nn.Linear(100, 10)\n",
    ")\n",
    "# Step 2a: Define the loss function and the optimizer\n",
    "\n",
    "criterion = nn.CrossEntropyLoss()\n",
    "optimizer = optim.Adam(model.parameters(), lr=0.01)\n",
    "\n",
    "# Step 3: Create the ART classifier\n",
    "\n",
    "classifier = PyTorchClassifier(\n",
    "    model=model,\n",
    "    clip_values=(min_pixel_value, max_pixel_value),\n",
    "    loss=criterion,\n",
    "    optimizer=optimizer,\n",
    "    input_shape=(1, 28, 28),\n",
    "    nb_classes=10,\n",
    ")\n",
    "\n",
    "# Step 4: Train the ART classifier\n",
    "\n",
    "classifier.fit(x_train, y_train, batch_size=64, nb_epochs=3)\n",
    "\n",
    "# Step 5: Evaluate the ART classifier on benign test examples\n",
    "\n",
    "predictions = classifier.predict(x_test)\n",
    "accuracy = np.sum(np.argmax(predictions, axis=1) == np.argmax(y_test, axis=1)) / len(y_test)\n",
    "print(\"Accuracy on benign test examples: {}%\".format(accuracy * 100))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a174860",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "## PGD variant of Feature Adversaries\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2bbdefd4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Step 5: prepare a batch of source and guide images\n",
    "valid = np.argmax(y_test, axis=1)[:100] != np.argmax(y_test, axis=1)[100:200]\n",
    "source = x_test[:100][valid][:32]\n",
    "guide = x_test[100:200][valid][:32]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c900ec77",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "755d5f9376cd4c9f97782ad8405d5775",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Feature Adversaries PyTorch:   0%|          | 0/100 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy on adversarial test batch: 3.125%\n",
      "Average perturbation: 0.13725492358207703%\n"
     ]
    }
   ],
   "source": [
    "# Step 6: Generate adversarial test examples\n",
    "attack = FeatureAdversariesPyTorch(\n",
    "    classifier,\n",
    "    layer=7,\n",
    "    delta=35/255,\n",
    "    optimizer=None,\n",
    "    step_size=1/255,\n",
    "    max_iter=100,\n",
    ")\n",
    "x_test_adv = attack.generate(source, guide)\n",
    "\n",
    "# Step 7: Evaluate the ART classifier on adversarial test examples\n",
    "\n",
    "predictions = classifier.predict(x_test_adv)\n",
    "accuracy = np.sum(np.argmax(predictions, axis=1) == np.argmax(y_test[:100][valid][:32], axis=1)) / len(y_test[:100][valid][:32])\n",
    "\n",
    "dim = tuple(range(1, len(source.shape)))\n",
    "pert = np.mean(np.amax(np.abs(source - x_test_adv), axis=dim))\n",
    "print(\"Accuracy on adversarial test batch: {}%\".format(accuracy * 100))\n",
    "print(\"Average perturbation: {}%\".format(pert))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "68717bc9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a6bc4bb0>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAUdUlEQVR4nO3dbYyc1XUH8P9/ZndtsAHbGBbH2GBcQ3B4S7IBSmjklDYCVAkiNTRui0hF6ygKakJQG0RVhU8tihoQVQuSCS6QUCKqgOADChiXYkVRHQw1NubNxi9gs+v1u9fY692ZOf2wQ7TA3nPXc2fmGXH/P2m14zlz57n7rM8+M3PuC80MIvLpVyq6AyLSHkp2kUwo2UUyoWQXyYSSXSQTXe08WA+n2FRMC8bZ3e22t9HRcNsTpvptjw67cU7pceNwihY2MuK3jUjue1c53LZa89uW/L/3Vq268RSxY8dYzf/ZkjB28NYdOuXYw/gAI3ZswmdISnaSVwO4F0AZwE/N7C7v8VMxDZfxqmC8q/cz7vEqO98Pxkrnne+2rb36hhsvz1/gxukkTWXrdrdtTHLfZ54abntwyD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JhJJdJBNKdpFMKNlFMqFkF8mEkl0kE/8PaRO/p2PLIsQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Step 8: Inspect results\n",
    "\n",
    "# orig 7, guide 6\n",
    "plt.imshow(x_test_adv[0,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5aabd4ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a4ac74c0>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAUFUlEQVR4nO3dbYxc1XkH8P9/Zne99toGv8CyfqkxxhhIKSZaEdKgiggFEfoBolYoSE1phbpRG6Qk5UMR/RDUTzRqiPIhTeUUiomIEVWg+ANq4liRrDQFYZAxtnmxMXbtZf2KzdqGfZmZpx/2Qhez5znLvTNzp5z/T1rt7jxz7j17Z569M/Pccw7NDCLy2VcpuwMi0h5KdpFEKNlFEqFkF0mEkl0kEV3t3FkP51gv+oJxVvz/PdZohNvO7fXbfjDmxmPti2w7Jvp3W/jvnrpDkZ3TD/d0+7sen8i/6wLHHJjFYzqnJxyMHfOij2lJz6cxnMOEjc/4oBZKdpK3AvgRgCqAfzWzh7z796IPX6jeEoxXIgeoce5cuO26q/y2r7zmxmPti2w7pjJ3nhu3CT+hrFZzNl5127LqxyurVrjx+t79btzddoFjDsSPe9eKS8NtF8z1t73zdX/nkZJ15fIr/fbV8D/ZIs+nF2xrMJb7ZTzJKoAfA/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gilOwiiVCyiyRCyS6SiLbW2UkeB3Bw2k1LAZxoWwc+nU7tW6f2C1Df8mpm31aZ2Yzze7c12T+xc3K7mQ2W1gFHp/atU/sFqG95tatvehkvkgglu0giyk72DSXv39OpfevUfgHqW15t6Vup79lFpH3KPrOLSJso2UUSUUqyk7yV5Bsk95G8v4w+hJA8QPJVkjtIbi+5L4+SPEZy17TbFpPcQnJv9n3GNfZK6tuDJIezY7eD5G0l9W0lyd+Q3ENyN8lvZ7eXeuycfrXluLX9PTvJKoA3AXwFwGEALwK4y8z2tLUjASQPABg0s9IvwCD5RwDOAnjczH4/u+37AN41s4eyf5SLzOzvOqRvDwI4W/Yy3tlqRQPTlxkHcAeAv0CJx87p151ow3Er48x+PYB9ZrbfzCYAPAng9hL60fHMbBuAd8+7+XYAG7OfN2LqydJ2gb51BDMbMbOXs5/PAPhwmfFSj53Tr7YoI9mXAzg07ffD6Kz13g3Ar0i+RHKo7M7MoN/MRrKfjwDoL7MzM4gu491O5y0z3jHHLs/y50XpA7pPutHMPg/gqwC+lb1c7Ug29R6sk2qns1rGu11mWGb8I2Ueu7zLnxdVRrIPA1g57fcV2W0dwcyGs+/HADyDzluK+uiHK+hm34+V3J+PdNIy3jMtM44OOHZlLn9eRrK/CGAtydUkewB8HcDmEvrxCST7sg9OQLIPwC3ovKWoNwO4O/v5bgDPltiXj+mUZbxDy4yj5GNX+vLnZtb2LwC3YeoT+bcA/H0ZfQj06zIAr2Rfu8vuG4BNmHpZN4mpzzbuAbAEwFYAewH8GsDiDurbzwC8CmAnphJroKS+3Yipl+g7AezIvm4r+9g5/WrLcdPlsiKJ0Ad0IolQsoskQskukgglu0gilOwiiVCyiyRCyS6SiP8Fqqyud6tjg6oAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 1, guide 5\n",
    "plt.imshow(x_test_adv[2,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1765536f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a4ae6b50>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVgklEQVR4nO3da4yc1XkH8P9/Zne9+H5Z8D3YwBpwuDjNhroJUBAlAprK5EMpfCBOg+pEBDVIUVVEFIV+iISqhChSK1QDTkxDSUkJxVJRwHVpEYkgLAh8NzbGYC++YBt7fVvvzrxPP+xAF9jznGXeudHz/0mrnZ1nzvuefXeefWfmec85NDOIyP9/hWZ3QEQaQ8kukgglu0gilOwiiVCyiySirZE762CndXJC+AE5KgM8o9ON26mBXO3zbDuGbUV/+6Wy376JfW8mkm7cqzRxXEds4/62B07nas/2cOrZ4JC/bccATmDQTo+681zJTvI6AD8FUATwoJnd6z2+kxOwdNz1wbgNlfwdZuEnfeH8C/2mr21x47H2ebYdU5w63Y2XDx1244VFF4SDkSddtn6rG4+qZ+k20vfCuHFuPBsI/yNrm7fAbWtOMgJAedsON85I34pnnRmMlXbvcdt6XrR1wVjVL+NJFgH8I4DrASwGcAvJxdVuT0TqK8979ssA7DCznWY2COCXAJbVplsiUmt5kn0ugN0jft5Tue9DSK4g2Uuyd8g+ve8PRT7t6v5pvJmtNLMeM+tpZ/UfJIlIPnmSvQ/A/BE/z6vcJyItKE+yvwSgm+RCkh0AbgawpjbdEpFaq7r0ZmYlkncAeBrDpbdVZrbJa0MSbAvvMlY3zQbCpbe85a+87fMov3fUf0DsuGzYVsPefDLFadMiDwifT8oHD/ltI2W92IjNttm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HYDtAP4TwPQW6ts/A9gAYD2GE2t2k/p2OYZfoq8H8Grl64ZmHzunXw05brpcViQR+oBOJBFKdpFEKNlFEqFkF0mEkl0kEUp2kUQo2UUS8b/17typVwsyJwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 4, guide 9\n",
    "plt.imshow(x_test_adv[4,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "1361622b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a4a17190>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAUa0lEQVR4nO3dfZCV1X0H8O/37i7i8v4iiEAQDKJYA5oVTTEdG9sUbSeY6YyJdizpaHEm2kkaqzWmHZ1Op3GcaN6mJkPUih2jcZpYcYZoKLW1xpeABnlRCC9CWFhYXlQWBXb33l//2KtZdc/vLPe59z5Xz/czw+zu/d1znsPD/njuvb/nnEMzg4h89BXyHoCI1IeSXSQRSnaRRCjZRRKhZBdJRHM9DzaEJ9hQDKtN54zEsxYd3P79g0eHlrEiwhOHVtzWjhzNdOwohv/2Wc8Lm5v89sVSuG1Li3/wQmR03T1+PMJKzticcxZzxN5Ctx0dsINMyU5yAYDvAmgCcI+Z3e49fyiG4XxenOWQ4bE0+38V6+2tXf9N/i9d7B+vFPvFKRXdcGHWmX57r+uXX6247WCwZUg41uS/sIydl6bRo/z2hw6H206Z5La1E0/w49vb3XhM6e23g7HC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E/D+8z4jh6NHt1gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 4, guide 2\n",
    "plt.imshow(x_test_adv[6,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e6f7cb47",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a49f48b0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAVGUlEQVR4nO3de3Bc1X0H8O9vVyvLli3b8kNWbAfz8AMXE6CqISlJSJkkDmXGkDYMnk7GTkmcDpgmE2ZaQjoT0ikztDQQ+oDWBBfToaYMj8HToTzq0oGU2kYQY1t+Y2xsR5aNX3oYWdq9v/6hCyNA53eWvbt7F873M6ORtL899x7d3Z/u7v7uOUdUFUT06ZdJuwNEVB1MdqJAMNmJAsFkJwoEk50oEHXV3Fm9jNIGNFZzl9UhnnjSgodv+/47uLEaU3sSPJ/60YcBPTPiFhIlu4gsAnAvgCyAX6rqndb9G9CIS+XK0neYybpjGtltkz6pxf0ISNboFwCNPPuOCvau6zwPk7V/z741P2hvO9R/BsbjXRTfcavQ82lD4XlnrOSX8SKSBfCPAL4BYD6AJSIyv9TtEVFlJXnPvhDAHlXdq6oDAB4FsLg83SKickuS7NMBHBj2+8H4tg8QkeUi0i4i7YM4k2B3RJRExT+NV9WVqtqmqm05jKr07ojIIUmyHwIwc9jvM+LbiKgGJUn2VwHMFpGzRaQewPUA1panW0RUbiW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9LJuEEOfbdwAYBKAdQB2A/gvAM011Ld/xdDS3psxlFitKfXtcgy9RN8MYFP8dVXax87oV1WOGy+XJQoEP6AjCgSTnSgQTHaiQDDZiQLBZCcKBJOdKBBMdqJA/D8LnMy9WxXmXAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 5, guide 9\n",
    "plt.imshow(x_test_adv[8,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "1489dc86",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a4952ee0>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAUq0lEQVR4nO3df3Bc1XUH8O/ZlWzZsmVbGIRju9iADThQHKJgKLQ4paWOZxIInWEgmQAdN2Y6kIZOpg2l7QAdOnF/kJSZUloHezAphSEFCi0M4HjIUCgYhMfIP4X8Q/4pWxhjy8ZY0u6e/qFnKkD3XPnd3X1L7vczo5G0Z+97d5/26O3uefdeUVUQ0a++XNYdIKLqYLITRYLJThQJJjtRJJjsRJGoq+bORslobUBjZTYuYofz9v81LRTt9mMaTrpLH2/7o+Op246ENIx2BwuF0K0Htdbg/btJvefpWyo5Q1p0xwBAcp7zoC/ueb5hwH1c1Oi3z3F8iH7tG/aPFpTsIrIAwP0A8gAeUtUl1v0b0Ih5ud9Jv0OjTCijjSc8gNz4cWa8eOB9u/0555lxS+mdTanbjkR+xtnu4IGDYRuvCzsfFPf3hO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ox2BiTcmob5dj8CV6O4C1ydfCrI+d0a+qHDdeLksUCX5ARxQJJjtRJJjsRJFgshNFgslOFAkmO1EkmOxEkfg/mlyscS3sDOkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 0, guide 8\n",
    "plt.imshow(x_test_adv[10,...].squeeze())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18bc254a",
   "metadata": {},
   "source": [
    "\n",
    "## Unconstrained variant of Feature Adversaries\n",
    "\n",
    "This variant approximates the original hard constraint problem of the paper. Any available PyTorch optimizer can be used. We will use Adam as a good default one.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "70d9fbba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "3976663efe8e41208e8fa7eef698efa4",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Feature Adversaries PyTorch:   0%|          | 0/100 [00:00<?, ?it/s]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Accuracy on adversarial test batch: 0.0%\n",
      "Average perturbation: 0.2517760694026947%\n"
     ]
    }
   ],
   "source": [
    "# Step 6: Generate adversarial test examples\n",
    "attack = FeatureAdversariesPyTorch(\n",
    "    classifier,\n",
    "    layer=7,\n",
    "    delta=61/255,\n",
    "    optimizer=optim.Adam,\n",
    "    optimizer_kwargs={\"lr\": 0.01},\n",
    "    lambda_=1.0,\n",
    "    max_iter=100,\n",
    "    random_start=True\n",
    ")\n",
    "x_test_adv = attack.generate(source, guide)\n",
    "\n",
    "# Step 7: Evaluate the ART classifier on adversarial test examples\n",
    "\n",
    "predictions = classifier.predict(x_test_adv)\n",
    "accuracy = np.sum(np.argmax(predictions, axis=1) == np.argmax(y_test[:100][valid][:32], axis=1)) / len(y_test[:100][valid][:32])\n",
    "\n",
    "dim = tuple(range(1, len(source.shape)))\n",
    "pert = np.mean(np.amax(np.abs(source - x_test_adv), axis=dim))\n",
    "print(\"Accuracy on adversarial test batch: {}%\".format(accuracy * 100))\n",
    "print(\"Average perturbation: {}%\".format(pert))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "78e7ed4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a48cd370>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAX/UlEQVR4nO3de3CcV3kG8Ofdi7S6+CbJlm35msRJZBLs2CJxTCBuTZOQADbTGYZ0hoZOWgcKlEyZTilth3TKTNMLMDDT0jEkJVCaNFMINo7bXFymSYoxluNrrDhOHF8ky5J8113a3bd/aAMi6LxH3k97oef5zXgk76Pz7dFqX32rPd85R1QVRPT/X6zUHSCi4mCxEwWCxU4UCBY7USBY7ESBSBTzziqSNZqqnOnMNSZm+9jwqDvMZM222epKM5feATuPGb8Xk/bDqMMjdj6j2s7thwWxi3bfLVKVsr9gNG3nibgZ69DwFfboF6Siwj72iP24FlS1/biJ5/loPSeifN9D6MeIDk/4jIlU7CJyF4CvAYgD+JaqPmx9fapyJm5e8Ulnnq6xu1N1pMuZaV+/2XZo9VVmnvzvfWYeS7l/WcTmzjHbpo8dN/Oh2282c/W8/qra8jP7Cwyxa643c+k5bx+gfqYZZw6/doU9+oVE0yIzTx8/mfexvWL2LzG53n7c4pfs56P1nEgsWGy3ffOEM9ulO5xZ3i/jRSQO4B8BvB/AcgD3isjyfI9HRIUV5W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ain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Step 8: Inspect results\n",
    "\n",
    "# orig 7, guide 6\n",
    "plt.imshow(x_test_adv[0,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "dce73b0f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a48a2e50>"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAXOklEQVR4nO3da5CcVZkH8P/T3XOfJCQkhtxIyAUiBExwEBFQlBIQZROsLVeqtNhdyvBBq7TWD0uxH+TDbpW7ter6wbU2rpRoeSldxMAurmBKQZbLZoAAuUAScoGMuU9IMvfp7mc/TAcDzPmfod+Z7q49/19Vaib99On3pKefvD39vOc55u4Qkf//cvWegIjUhpJdJBFKdpFEKNlFEqFkF0lEoZYHa7YWb0VHLQ/5Jp/ezuOR//ZyJwfJ4GwVDWtppnEfHuHjW1vCY4eGqx47EbHHp2Nn8J9JTK6fPy8A+bnk8nzk6CiNW56/YLxY4uML4ePHxqKzLRgaGnoDI6P9Nl4sU7Kb2U0Avg0gD+Df3f3r7P6t6MCVdn2WQ1Zt5OoraLzUOu7z86b2X78QjPlw5AVv/LELCxfTeHHPPhrPL78oGCtte6XqsQCAcpmGSzt28fHE0Ic/wO/AnzZ0PL2X38HDc7dpnXRo6Y+HaDwXG3/sOI3nz5kVHnu8l44td60JxjZ3fycYq/ptvJnlAXwHwCcAXAzgNjO7uNrHE5GpleV39g8A2O3ue9x9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OrVHnBWhu1arV3PQ2XiQRSnaRRNQ72TfU+fhMo86tUecFaG7Vqsnc6vo7u4jUTr3P7CJSI0p2kUTUJdnN7CYze8XMdpvZXfWYQ4iZ7TOzl8xsi5ll3Jc381zuNbMjZrb1rNtmmdmjZrar8jW8B3bt53aPmfVUnrstZnZznea2yMx+Z2bbzWybmX25cntdnzsyr5o8bzX/nd3M8gB2Avg4gAMANgO4zd2313QiAWa2D0CXu9f9Agwz+zCAPgA/dPdVldv+CUCvu3+98h/lTHf/2waZ2z0A+uq9jXdlt6J5Z28zDmAdgL9EHZ87Mq/PoAbPWz3O7B8AsNvd97j7CICfAVhbh3k0PHd/HEDv225eC+C+yvf3YezFUnOBuTUEdz/o7s9Vvj8N4Mw243V97si8aqIeyb4AwOtn/f0AGmu/dwfwiJk9a2br6z2Zccx194OV7w8BmFvPyYwjuo13Lb1tm/GGee6q2f48K31A907XuPvlAD4B4IuVt6sNycd+B2uk2umEtvGulXG2GX9TPZ+7arc/z6oeyd4DYNFZf19Yua0huHtP5esRAA+g8baiPnxmB93K1yN1ns+bGmkb7/G2GUcDPHf13P68Hsm+GcAKM7vAzJoBfBbAg3WYxzuYWUflgxOYWQeAG9B4W1E/COD2yve3A9hYx7m8RaNs4x3aZhx1fu7qvv25u9f8D4CbMfaJ/KsA/q4ecwjMaymAFyp/ttV7bgB+irG3daMY+2zjDgDnAtgEYBeA3wKY1UBz+xGAlwC8iLHEmlenuV2DsbfoLwLYUvlzc72fOzKvmjxvulxWJBH6gE4kEUp2kUQo2UUSoWQXSYSSXSQRSnaRRCjZRRLxf3OMFrmmZa4OAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 1, guide 5\n",
    "plt.imshow(x_test_adv[2,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "8082690b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a480a610>"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAY2ElEQVR4nO3deZDcZZkH8O/T3XPP5A7J5CDhCGgC5JqAQEpQFBDXDe5arFi7i6tFtFZ3sdY9LLVK/nCr2C3AYtczrpR4LJSruKDLihhRiELIQA5ymYSQmEyOyUXmyBx9PPvHdKyA835/Y/dM99S+309Vaib9zNu/N9395NfTz+95X3N3iMj/f6lqT0BEKkPJLhIJJbtIJJTsIpFQsotEIlPJg9VandejKRi3mho63rPZko9t6YT/1wq8KsGqFtZQz+87l+P3neXxJFZfV9Z4Kl+g4cTnxIwMHttKkLc0BmOW9O/K8NeLdZ0paU6/G58K3783JbyeiP7+Uxgc7B32QS8r2c3sZgAPAEgD+A93v4f9fD2acJXdEIxnZsyix8t1HCphlkPSzRNo3AcHabzQ3x+MpS5+Ex2bOn6KxnNHjtJ4kvT8i8PBTJoPLvAXvXXzF3XuYAcfX1MbjHmWP+blyl21PBirORl+PgGgf2b4PwoAqPvfDSXN6axUQ/j+syv464lp3/Cl8DFLvVMzSwP4EoB3AVgI4HYzW1jq/YnI2Crnd/YrAexx973uPgjgEQCrRmdaIjLaykn22QAOnPP3g8XbXsfMVptZu5m1ZzFQxuFEpBxj/mm8u69x9zZ3b6vBGH6QJCJUOcneAWDuOX+fU7xNRMahcpJ9A4AFZnaBmdUCeD+Ax0dnWiIy2kouvbl7zsw+DuBJDJXeHnT3beVMJqm0lp4+PTyf3l5+563n0bC38Npmujtcqslv3UnH8uIWMHhTG43XPtlO49mZLcFYzfGEevD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dz+zaGtvbegqHEaq3S3FZi6C36FgCbin9uqfZjR+ZVkcdNl8uKREIf0IlEQskuEgklu0gklOwikVCyi0RCyS4SCSW7SCT+D7OVmFnVLzNLAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 4, guide 9\n",
    "plt.imshow(x_test_adv[4,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "a68f96b7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a47f0190>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAX5UlEQVR4nO3de3CcV3kG8Ofdm1Y3X+SLLNuKHcch2A6J48iB3IoLE9dxCDbtNCUMmbST1rSFlnSYDpR2hvxTJi2QAEOGjgOGhBKYzBCakJsTHCDkYmPZyPfEF0WKpUhyHMexdV3t7ts/tGaUROc9Yld7gfP8ZjyS9tnzfccrvdrVnu+cI6oKIvrjFyl3B4ioNFjsRIFgsRMFgsVOFAgWO1EgYqU8WSJardWx6c5cUymzvcSN7kainrPbow4a9fzeGxz2HN9NYvbDnK1J2O3PDOZ97oKJJ69O2rnxuEmV/f+G2CfX4RG7ecJ9fN/Pmo9Or/HcwXcAd+R7yHHW/fMwjAGkdGTCQxRU7CKyDsA3AEQBfEdV77TuXx2bjqsWftKZpzu7zPPF5sxxZlpfa7aVdMbMM9Pt9vrbA2ZuiTa4+w0AQ6sWmXlia2ve5y6U7xcVVrzXjLV1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05f6tL/djZ/SrJI8bL5clCgTfoCMKBIudKBAsdqJAsNiJAsFiJwoEi50oECx2okD8P9qtS6VwkH9sAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 4, guide 2\n",
    "plt.imshow(x_test_adv[6,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "7a16e8fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a48319d0>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAYQklEQVR4nO3de3CcV3kG8OfdXV1Xkm3FtqzYkm9xDHYuDlZuTkpDTXMxZBzagZC0adqmNdOBGRhoKYVQ0ul0Js2UpPyRgRElxaRAgAGSACHBCcHGOI4tJ8ZWYse3yLZsXZzYsixZ0t7e/qEVowSd9yi70u625/nNeCTvo/N9R6t9tdo93zlHVBVE9P9fpNgdIKLCYLETBYLFThQIFjtRIFjsRIGIFfJk5VKhlYi7v6C60j7A+eGp7dB4InYccf9ezFRX2G0Hhuy8vMzMkc7YudE3TSTstjVVZqwRz/2S8YzmeL73fEiV5/FifO/qu0995y4vN3Pv/W4dOxq1j13lPvfwcB8SycEJf2h5FbuI3AzgKwCiAP5LVe+3vr4ScVwta93HW7HSPJ/ueiWHXk6OlNk/vEjcXRQjqy8y25Zt2Wsfu3m+mePsgBlLTbUzS71+1GybabnCzFOV9gOvbCBl5vKb3Waej8i7VtjnPtLpzNL9/XmdOza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1H/jCALxSjD45+LQHw2+y/V4rdNwDfxeifdUmMvrdxD4ALADwH4CCAZwHUl1DfHgWwF8AejBZWY5H6dj1G/0TfA2B39t+6Yt93Rr8Kcr/xclmiQPANOqJAsNiJAsFiJwoEi50oECx2okCw2IkCwWInCsT/An2vctPR9CHeAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 5, guide 9\n",
    "plt.imshow(x_test_adv[8,...].squeeze())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "8efcd647",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x7f33a4731460>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD4CAYAAAAq5pAIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAW2klEQVR4nO3de2zc1ZUH8O+ZGdtjO+8HiUkCJCQhDY8GMBCSlEKBNgnLJl22bBFi6RKRdgtaqNBuWXalIu12hbaliEoFKSxRQ0thq/LKslkgNdCIR0KcYPKEEBLn4TwhkNixHXtmzv7hoTLge+4wv3nB/X4ky+M5c3+/6/Ec/2Z+53fvFVUFEX35xcrdASIqDSY7USCY7ESBYLITBYLJThSIRCl3Vp2o02TNMGdcelJme03Z8Sh0aJ0Zl6Od7liyxt5294m8+pSrzDC77+UUO9rlDkasBEl1lRnXnl5329qkvfFed1sA0FTabj+o1o53GM9LBN04jh49IQPFIiW7iMwFcD+AOID/UtV7rMcna4Zh5rTFznhs32Fzf+mDh/LoZW66L7nQjCeffcMZi58+1Wyb3rItrz7lqutSu+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/APYtX6XqG9/GEwWCyU4UiHIn+5Iy799SqX2r1H4B7Fu+StK3sn5mJ6LSKfeRnYhKhMlOFIiyJLuIzBWRd0Rku4jcWY4+uIhIq4hsFJEWEWkuc1+WisghEdnU774RIrJSRN7Nfh9wjb0y9e1uEWnLPnctIjK/TH2bICIvicgWEdksIrdl7y/rc2f0qyTPW8k/s4tIHMA2AFcC2AtgLYDrVDXCzBWFIyKtABpVtewXYIjIJQA6ADyiqmdl7/tPAEdU9Z7sP8rhqvrjCunb3QA6yr2Md3a1oob+y4wDWAjgeyjjc2f061qU4Hkrx5H9QgDbVXWHqvYAeBzAgjL0o+Kp6ioARz519wIAy7K3l6HvxVJyjr5VBFXdr6rrs7fbAXy8zHhZnzujXyVRjmQfB2BPv5/3orLWe1cAL4jIOhFZXO7ODGCMqu7P3j4AYEw5OzMA7zLepfSpZcYr5rnLZ/nzqHiC7rPmqOp5AOYBuCX7drUiad9nsEqqnea0jHepDLDM+J+V87nLd/nzqMqR7G0AJvT7eXz2voqgqm3Z74cAPIXKW4r64Mcr6Ga/27NVllAlLeM90DLjqIDnrpzLn5cj2dcCmCIiE0WkGsB3ASwvQz8+Q0TqsydOICL1AL6JyluKejmAG7O3bwTwTBn78gmVsoy3a5lxlPm5K/vy56pa8i8A89F3Rv49AP9Sjj44+jUJwFvZr83l7huAx9D3tq4Xfec2FgEYCaAJwLsA/ghgRAX17TcANgLYgL7EaihT3+ag7y36BgAt2a/55X7ujH6V5Hnj5bJEgeAJOqJAMNmJAsFkJwoEk50oEEx2okAw2YkCwWQnCsT/A03DEnXkkKEAAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# orig 0, guide 8\n",
    "plt.imshow(x_test_adv[10,...].squeeze())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
